import express from 'express';
import {
  getNewStudentClasses,
  getNewStudentClassById,
  createNewStudentClass,
  updateNewStudentClass,
  deleteNewStudentClass,
  searchNewStudentClasses
} from '../controllers/newStudentClassController.js';
import { auth, hasPermission } from '../middleware/auth.js';

const router = express.Router();

// 受保护路由
// 新生分班表管理路由
// 获取所有新生分班表
router.get('/', 
  // auth, 
  // hasPermission('read_new_student_classes'), 
  getNewStudentClasses);
// 模糊查询路由，必须放在/:id路由之前
router.get('/search', 
  // auth, 
  // hasPermission('read_new_student_classes'), 
  searchNewStudentClasses);
router.get('/:id', 
  // auth, 
  // hasPermission('read_new_student_classes'), 
  getNewStudentClassById);


// 新增路由
router.post('/', 
  auth, 
  hasPermission('create_new_student_classes'), 
  createNewStudentClass);
// 更新路由
router.put('/:id', 
  auth, 
  hasPermission('update_new_student_classes'), 
  updateNewStudentClass);
// 删除路由
router.delete('/:id', 
  auth, 
  hasPermission('delete_new_student_classes'), 
  deleteNewStudentClass);



export default router;